const sqlQuery=require('../../module/lcMysql')
module.exports=async (req,res,next)=>{
    let page=parseInt(req.query.page) 
    let limit=req.query.limit
    var sqlStr,result,sqlStr2,result2;
    try {
        sqlStr="select * from user  where roleid=1 and (del !='1' or del is null) limit ?,?"
        result=await sqlQuery(sqlStr,[(page-1)*parseInt(limit) ,parseInt(limit) ])
        sqlStr2="select count(id) as num from user where roleid=1 and (del !='1' or del is null)"
        result2=await sqlQuery(sqlStr2)
    } catch (error) {
        next(error)
    }
    res.json({
        "code":0,
        "msg":"ok",
        "count":result2[0].num,
        "data":Array.from(result)
    })
}